<%- Loader('/public/stylesheets/pics.min.css')
.css('/public/stylesheets/pics.less')
.done(assets, config.site_static_host, config.mini_assets)
%>
<div id='sidebar'>

  <div class='panel'>
    <% if (typeof(user) !== 'undefined' || current_user) { %>
    <div class='header'>
      <span class='col_fade'>个人信息</span>
    </div>
    <div class='innerTopic'>
      <%- partial('user/card',{ object: typeof(user) === 'undefined' ? current_user : user, as: 'user' }) %>
    </div>
    <% } else { %>
    <div class='innerTopic'>
      <p><%= config.description %></p>

      <div>
        您可以
        <a href='/signin'>登录</a>
        或
        <a href='/signup'>注册</a>
        , 也可以
        <a href="/auth/github">
          <span class="span-info">
            通过 GitHub 登录
          </span>
        </a>
      </div>
    </div>
    <% } %>
  </div>

  <% if (current_user) { %>
  <div class="panel">
    <div class='innerTopic' style="text-align: center;">
      <a href="/topic/create" class="btn"><strong>
        发布话题</strong><span></span></a>

      <a id='create_pic_btn' data-toggle="modal" data-target="#image_upload" class="btn wbtn"><strong>
        发布图片</strong><span></span></a>

    </div>
  </div>
  <% } %>

  <% if (!current_user || !current_user.isAdvanced) { %>
    <%- partial('./_ads') %>
  <% } %>

  <% if (typeof(no_reply_topics) !== 'undefined') { %>
  <div class='panel'>
    <div class='header'>
      <span class='col_fade'>无人回复的话题</span>
    </div>
    <div class='innerTopic'>
      <% if (no_reply_topics.length > 0) { %>
      <ul class="unstyled">
        <%- partial('topic/small', { collection: no_reply_topics, as: 'topic' }) %>
      </ul>
      <% } else { %>
      <p>无</p>
      <% } %>
    </div>
  </div>
  <% } %>

  <% if (typeof(tops) !== 'undefined') { %>
  <div class='panel'>
    <div class='header'>
      <span class='col_fade'>积分榜</span>
      &nbsp;
      <a class='dark' href='/users/top100'>TOP 100 &gt;&gt;</a>
    </div>
    <div class='innerTopic'>
      <% if (tops.length > 0) { %>
      <ol>
        <%- partial('user/top', { collection: tops, as: 'user' }) %>
      </ol>
      <% } else { %>
      <p>无</p>
      <% } %>
    </div>
  </div>
  <% } %>

</div>

<!-- 创建图片时要选择的Board列表 -->
<script id="boardTemplate" type="text/x-jquery-tmpl">
    <%- partial('board/_board_list') %>
</script>

<%- partial('topic/_pic_create_modal') %>

<%- Loader('/public/pics.min.js')
.js('/public/libs/masonry.pkgd.js')
.js('/public/libs/imagesloaded.pkgd.min.js')
.js('/public/libs/Q.Uploader.image.all.js')
.js('/public/libs/load-image.all.min.js')
.js('/public/javascripts/board.js')
.js('/public/javascripts/pics_create.js')
.done(assets, config.site_static_host, config.mini_assets)
%>

<% if (typeof(user) !== 'undefined' || current_user) { %>
<%- Loader('/public/boards.min.js')
.js('/public/javascripts/board_init.js')
.done(assets, config.site_static_host, config.mini_assets)
%>
<% } %>

<script type="text/javascript">
  isInsertImageBoardAfterCreate(false);
</script>